<?php


	$super_user=1;

	include("../lib/db.lib");
	include("../lib/std.lib");
	$shop_id=param("admin_shop_id");
	$cat_id=param("cat_id");
	$default_id=param("shop_id");

	

	$start=param("start");	
	if($start<1) $start=1;
	

	if(!$shop_id){ $shop_id=$default_id;}
	$shop_id=3;
	
	$title=cat_get_title($shop_id,$cat_id);
	
	setcookie("shop_id", $shop_id,time()+60*60*24*1,"/");
	setcookie("current_cat_id", $cat_id,time()+60*60*24*1,"/");

	if(param("switch")){
		cat_switch_id($shop_id,$cat1,$cat2);
	}

?>

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML><HEAD><TITLE>Cat Display: <?php echo $title;?></TITLE>
<META NAME='KEYWORDS' CONTENT=''/>
<LINK REL="stylesheet" HREF="wiki.css">
<META NAME="description" content="">
<meta http-equiv="Content-Style-Type"  content="text/css">
<meta http-equiv="imagetoolbar" content="no" />
<meta http-equiv="Content-Type"   content="text/html; charset=GB2312">

	
<SCRIPT LANGUAGE="JavaScript">
<!--
var last_id=-1;

function show_panel(id){
	if(last_id>=0){
//		document.getElementById(last_id.toString(10)).setAttribute("style","visibility:hidden;");
		document.getElementById(last_id.toString(10)).style.cssText = "visibility:hidden;";
	}
//	document.getElementById(id.toString(10)).setAttribute("style","background-color:#CFCA1F;border:1px solid #FFaa33;");
	document.getElementById(id.toString(10)).style.cssText = "background-color:#CFCA1F;border:1px solid #FFaa33;";
	last_id=id;
	return true;
}
function hide_panel(id){
//	document.getElementById(id).setAttribute("style","visibility:hidden;");
	document.getElementById(id).style.cssText = "visibility:hidden;";
	last_id=id;
	last_id=-1;
	return true;
}

// -->

</script>
	
	
</HEAD>
<body onClick="hide_panel(last_id)">
<?php include("header.php");?>

<?php

$shop_id=3;

shop_initiate($shop_id,"XYS article");

$top_cid=shop_root_cat($shop_id);
if(!$cat_id){
	$cat_id=$top_cid;
}

$cat_list=shop_part_catalogs($shop_id,$cat_id,$start-1,50);
$childs_num=cat_get_childs_num($shop_id,$cat_id);




$last_cid=cat_get_parent($shop_id,$cat_id);

show_time(" dislpay 1");
$num=cat_get_all_product_num($shop_id,$cat_id);
show_time(" dislpay 2");

//$total_num=cat_get_all_product_num($shop_id,1083);
?>
<div align=right>
<?php
if($last_cid>0) echo "<a href=\"?cat_id=$last_cid\">Go upper layer</a> ,&nbsp;&nbsp;\n";

 echo "<a href=\"?cat_id=$top_cid\">Go Top</a> &nbsp;&nbsp;&nbsp;\n";
 echo "<a href=\"http://api2.jp/code/\"></a><br>\n";
// echo "<hr size=1 width=250 align=left>";
?>

</div>

<?php
//$cat_list=shop_all_catalogs($shop_id);

//shop_initiate($shop_id,"");

show_time(" dislpay catalogs");
display_catalogs($shop_id,$cat_list,$cat_id,"");

        $pre_start=$start-50;
        if($pre_start>0) 
		echo "<a href=\"p_cat_show.php?start=$next_start&cat_id=$cat_id\">Previous 50 </a>&nbsp;";
        if($childs_num >=$start+50){
                $next_start=$start+50;
                echo "<a href=\"p_cat_show.php?start=$next_start&cat_id=$cat_id\">Next 50</a> &nbsp;(Total $childs_num )";
        }

include("copyright.php");
?>

</body>
</html>
